#!/bin/bash

SITE_PATH='/var/www/opencart'

apt-get -q -y install unzip
cp /vagrant/setup/* /home/vagrant/
unzip /home/vagrant/*.zip
mv /home/vagrant/upload/config-dist.php /home/vagrant/upload/config.php
mv /home/vagrant/upload/admin/config-dist.php /home/vagrant/upload/admin/config.php
mv /home/vagrant/upload/ "$SITE_PATH/"
chown -R www-data "$SITE_PATH/"
find "$SITE_PATH/" -type d -exec chmod 777 {} \;
find "$SITE_PATH/" -type f -exec chmod 666 {} \;
service apache2 restart